package com.biwano.swapmyjob.beans.user;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

import com.biwano.swapmyjob.objects.JobExchange;

@ViewScoped
@ManagedBean
public class JobExchangeBean {
	JobExchange jobExchange;

	@ManagedProperty(value="#{userBean}")
	private UserBean userBean;
	
	public void setUserBean(UserBean userBean) {
		this.userBean = userBean;
	}

	public JobExchange getJobExchange() {
		
		if (jobExchange==null)
		{
			jobExchange=userBean.getUser().getJobExchange();
			if (jobExchange==null)
				jobExchange=new JobExchange();
		}
		return jobExchange;
	}

	public void setJobExchange(JobExchange jobExchange) {
		this.jobExchange = jobExchange;
	}
	
	
}
